/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.marcos.util;

import com.marcos.entities.Alumno;
import java.util.ArrayList;
import java.util.Iterator;

/**
 *
 * @author educacionit
 */
public class CreadorDeHTML {
    private static Alumno Alumno;
    
    
    public static String getComboDeAlumnos(ArrayList losAlumnos){
        /*
        Alumno a = new Alumno(1,"Juan","Perez");
        Alumno a2 = new Alumno(2,"Pedro","Gonzalez");
        Alumno a3 = new Alumno(3,"Rocio","Pereyra");
        
        alumnos.add(a);
        alumnos.add(a2);
        alumnos.add(a3);*/
        
        String combo = "<select>";
        Iterator it = losAlumnos.iterator();
        while(it.hasNext()){
            Alumno a = (Alumno) it.next();
            combo +="<option value="+a.getNombre()+">"+a.getNombre()+" "+a.getApellido()+"</option>";
        }
        combo+="</select>";
        return combo;
    }
    
    public static String getTablaDeAlumnos(ArrayList losAlumnos, String[] losCampos){
        String combo="";
        combo+="<table border=\"2\">";
        combo+="<tr><td>"+losCampos[0]+"</td>";
        combo+="<td>"+losCampos[1]+"</td>";
        combo+="<td>"+losCampos[2]+"</td></tr>";
        Iterator it= losAlumnos.iterator();
        while(it.hasNext()){
            Alumno a= (Alumno)it.next();
            combo+="<tr><td>"+a.getId()+"</td>";
            combo+="<td>"+a.getNombre()+"</td>";
            combo+="<td>"+a.getApellido()+"</td></tr>";
        }
        return combo;
    }
}
